home *** CD-ROM | disk | FTP | other *** search
- /*
- File: SelectionLibrary.h
-
- Contains: layout library interface: Routines to manipulate Selection objects
-
- Written By: Dave Opstad, Eric Mader
-
- Copyright: ©1992-1995 by Apple Computer, Inc. All rights reserved.
-
- Change History (most recent first):
-
- <2> 1/9/95 JD changed 'boolean' to 'Boolean'
- <1> 1/9/95 JD First checked in.
-
- */
-
- #ifndef __SELECTIONLIBRARY__
- #define __SELECTIONLIBRARY__
-
- #include <GXTypes.h>
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- /* for compatibility with old headers */
- #define selectionLibraryIncludes
-
- /* Constants and Enumerations */
-
- #define selectionExtremeEdge -1
-
- enum SelectionTypes {
- emptySelection,
- simpleCaret,
- simpleRange,
- discontiguousRange
- };
- typedef unsigned short SelectionType;
-
- enum SelectionMatches {
- notInSelection,
- partlyInSelection,
- fullyInSelection,
- equalToSelection
- };
- typedef unsigned short SelectionMatch;
-
- /* Types and Structures */
-
- typedef long SelectionOffset;
-
- struct SelectionOffsetRange {
- SelectionOffset minOffset; /* earliest char */
- SelectionOffset maxOffset; /* latest char */
- };
- typedef struct SelectionOffsetRange SelectionOffsetRange;
-
- struct SelectionRanges {
- long rangeCount;
- struct SelectionOffsetRange ranges[gxAnyNumber];
- };
- typedef struct SelectionRanges SelectionRanges;
-
- struct CaretPiece {
- SelectionOffset offset;
- short leadingEdge;
- };
- typedef struct CaretPiece CaretPiece;
-
- struct Selection {
- SelectionType type;
- union {
- struct CaretPiece caret;
- struct SelectionRanges range;
- } data;
- };
- typedef struct Selection Selection;
-
- typedef struct Selection* SelectionPtr, ** SelectionHandle;
-
- /* Routines */
-
- SelectionHandle NewEmptySelection(void);
- SelectionHandle NewCaretSelection(SelectionOffset offset, long leadingEdge);
- SelectionHandle NewRangeSelection(SelectionOffsetRange *range);
-
- SelectionHandle NewFullSelection(void);
- SelectionHandle NewStartSelection(SelectionOffset toOffset);
- SelectionHandle NewEndSelection(SelectionOffset fromOffset);
-
- void SetEmptySelection(SelectionHandle selection);
- void SetCaretSelection(SelectionHandle selection, SelectionOffset offset, long leadingEdge);
- void SetRangeSelection(SelectionHandle selection, SelectionOffsetRange *range);
-
- void SetFullSelection(SelectionHandle selection);
- void SetStartSelection(SelectionHandle selection, SelectionOffset toOffset);
- void SetEndSelection(SelectionHandle selection, SelectionOffset fromOffset);
-
- void DisposeSelection(SelectionHandle selection);
-
- SelectionType GetSelectionType(SelectionHandle selection);
-
- SelectionOffset GetCaretSelection(SelectionHandle selection, Boolean *leadingEdge);
- long GetRangeSelection(SelectionHandle selection, SelectionRanges *selectionRanges);
-
- SelectionMatch RangeInSelection(SelectionHandle selection, SelectionOffsetRange *range);
-
- void InvertSelection(SelectionHandle dest);
- void ShiftSelection(SelectionHandle dest, SelectionOffset delta);
-
- void UnionSelection(SelectionHandle dest, SelectionHandle source);
- void SectSelection(SelectionHandle dest, SelectionHandle source);
- void XorSelection(SelectionHandle dest, SelectionHandle source);
- void DiffSelection(SelectionHandle dest, SelectionHandle source);
-
- gxShape GetLayoutSelection(
- gxShape layout,
- SelectionHandle selection,
- SelectionOffset lineStart,
- gxHighlightType highlightType,
- gxCaretType caretType);
-
- SelectionHandle NewDiscontiguousSelection(SelectionRanges *ranges);
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif /* __SELECTIONLIBRARY__ */
-